//
//  ZZOrderHeaderViewCell.m
//  新项目
//
//  Created by liGordon on 16/12/20.
//  Copyright © 2016年 刘耀宗. All rights reserved.
//

#import "ZZOrderHeaderViewCell.h"
#import "ZZOrderContentModel.h"

@interface ZZOrderHeaderViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *imageIcon;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *phoneLabel;
@property (weak, nonatomic) IBOutlet UILabel *detailLabel;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;

@end

@implementation ZZOrderHeaderViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
}

+(instancetype)cellWithTableVIew:(UITableView *)tableView
{
    
    static NSString *identifier = @"orderCell";
    ZZOrderHeaderViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle]loadNibNamed:@"ZZOrderHeaderViewCell" owner:nil options:nil]firstObject];
    }
    return cell;
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)setModel:(ZZOrderContentModel *)model
{
    _model = model;
    
    
    NSString *string = model.Type;
    
    //字条串是否包含有某字符串
    
    
    if ([string containsString:@"维修"]) {
      [  self.imageIcon setImage:[UIImage imageNamed:@"ic_list_wx" ]];
    } else if([string containsString:@"美容"]){
        [self.imageIcon setImage:[UIImage imageNamed:@"ic_list_mr"]];
    }else if([string containsString:@"改装"]){
        [self.imageIcon setImage:[UIImage imageNamed:@"ic_list_gz"]];
    }else{
        [self.imageIcon setImage:[UIImage imageNamed:@"ic_list_by"]];
    }
   
    self.titleLabel.text = model.Type;
    self.nameLabel.text = model.CarOwner;
    self.phoneLabel.text = model.CarOwnerTel;
    self.priceLabel.text = [NSString stringWithFormat:@"¥%@",model.FeeFeceivable];
    NSString *timeStr = model.CreationTime;
    self.timeLabel.text = [timeStr substringToIndex:10];
    if (model.TypeName) {
        if (model.PlateNumber) {
                 self.detailLabel.text = [NSString stringWithFormat:@"%@(%@)",model.TypeName,model.PlateNumber];
        }else{
                self.detailLabel.text = [NSString stringWithFormat:@"%@(暂无车牌号码数据)",model.TypeName];
        }
    }
    else{
        if (model.PlateNumber) {
                  self.detailLabel.text = [NSString stringWithFormat:@"暂无车辆数据(%@)",model.PlateNumber];
        }else{
              self.detailLabel.text = [NSString stringWithFormat:@"暂无车辆数据(暂无车牌号码数据)"];
        }
    }
}

@end
